const path = require("path");
module.exports = {
    entry: "./src/index.ts",
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: "./bundle.js"
    },
    mode: "development",
    // 调试ts源码
    devtool: "inline-source-map",
    resolve: {
        extensions: [".tsx", ".ts", ".js"]
    },
    plugins: [],
    module: {
        rules: [
            // 使用ts-loader转译ts源码
            {
                test: /\.tsx?$/,
                use: 'ts-loader',
                exclude: /node_modules/
            }
        ]
    },
    devServer: {
        // 设置根目录
        publicPath: "./dist",
        // 压缩代码，加快开发
        compress: true,
        host: "localhost",
        port: 3000,
        // 所有404页面定位到index.html
        historyApiFallback: true,
        open: true
    }

}
